<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="/WEB-INF/templates/newMainCompanyTemplate.xhtml">
            <ui:define name="companyContent">
                <h:outputStylesheet library="css" name="company/company.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/folder/folder.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/folder/folder_desktop.css" media="screen and (min-width:1025px) and (max-width:1600px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/folder/folder_desktop_wide.css" media="screen and (min-width : 1601px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/folder/folder_tablet.css" media="screen and (min-device-width : 768px) and (max-device-width : 1024px), screen and (max-width:1024px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/folder/folder_smartphone.css" media="screen and (min-device-width : 320px) and (max-device-width : 767px), screen and (max-width:767px)"></h:outputStylesheet>
                
                <h:form id="newFolderForm">
                    <p:dialog modal="true" resizable="false" widgetVar="newFolderDialog" id="newFolderDialog" header="#{messages.NewFolder}">
                        <p:panel styleClass="noBorder" id="newFolderPanel">
                            <p:inputText id="name" required="true" value="#{newFolderListBean.newFolder.description}" requiredMessage="#{messages.NameRequired}" label="#{messages.Name}"></p:inputText>  
                            <p:watermark for="name" value="#{messages.Name}" />
                            <p:commandButton styleClass="redBackgroundStrong" process="@parent" value="#{messages.Create}" oncomplete="newFolderDialog.hide()" update=":folderListForm:folderListGrowl :foldersPanel" id="createFolderButton" actionListener="#{newFolderListBean.createNewFolder()}" />                        
                        </p:panel>
                    </p:dialog>
                </h:form>
                
                <p:dialog resizable="false" widgetVar="folderDetailDialog" modal="true" id="folderDetailDialog">
                    <p:panel styleClass="noBorder noMargin noPadding" rendered="#{newFolderListBean.chosenEntity!=null}">
                        <h:form id="editFolderForm">
                            <p:inputText required="true" value="#{newFolderListBean.chosenEntity.description}"></p:inputText>
                            <p:commandButton styleClass="redBackgroundStrong" actionListener="#{newFolderListBean.editFolder()}" value="#{messages.Edit}" update=":foldersPanel" process="@parent"></p:commandButton>
                        </h:form>
                    </p:panel>
                </p:dialog>
                
                <h:form id="folderListForm">
                    <p:growl id="folderListGrowl"></p:growl>
                    <p:commandButton styleClass="redBackgroundStrong" process="@this" value="#{messages.NewFolder}" update=":newFolderForm:newFolderPanel" actionListener="#{newFolderListBean.reinitNewFolder()}" oncomplete="newFolderDialog.show();"></p:commandButton>
                    <p:commandButton styleClass="blueBackgroundStrong" process="@this" ajax="false" value="#{messages.AllProfiles}" action="#{newFolderListBean.viewAllProfiles()}"></p:commandButton>
                </h:form>
                <p:panel id="foldersPanel" styleClass="noBorder noPadding noMargin" >
                    <ui:repeat id="folderRepeater" varStatus="step" var="folder" value="#{newFolderListBean.entityList}">
                        <p:panel styleClass="#{step.index%3==2 ? 'noMarginRight' : ''} noPadding noBorder folderRepeated inlineBlock">
                            <p:panel styleClass="ui-datalist ui-widget noBorder noMargin noPadding dataListSearchColumn">
                                <p:panel styleClass="strongGraySlimBorder noPadding noMargin folderType#{folder.companyFolderType.idCompanyFolderType}">  
                                    <div class="strongGraySectionBackground">
                                        <div class="internalSearchLeftColumn colorWhite inlineBlock verticalAlignTop">
                                            <h:outputText value="#{messages.Name}" />
                                        </div>
                                        <div class=" internalSearchRightColumn inlineBlock verticalAlignTop strongGraySlimBorderTop">
                                            <h:outputText styleClass="block" value="#{folder.description}"/>
                                        </div>
                                        <div class="internalSearchLeftColumn colorWhite inlineBlock verticalAlignTop">
                                            <h:outputText value="#{messages.ValidCandidates}" />
                                        </div>
                                        <div class=" internalSearchRightColumn inlineBlock verticalAlignTop ">
                                            <h:outputText id="valid" styleClass="block" value="#{folder.validCompanyAdquiredProfileFolderList.size()}"/>
                                        </div>
                                    </div>
                                </p:panel> 
                            </p:panel>
                            <h:form>
                                <p:commandButton style="margin-right: 0.5em" styleClass="redBackgroundStrong" update=":folderDetailDialog" oncomplete="folderDetailDialog.show()" value="#{messages.Edit}" actionListener="#{newFolderListBean.setChosenEntity(folder)}" process="@this"></p:commandButton>
                                <p:commandButton styleClass="redBackgroundStrong" ajax="false" value="#{messages.See}" action="#{newFolderListBean.redirectToViewEntity()}" actionListener="#{newFolderListBean.chooseEntity(folder)}" process="@this"></p:commandButton>
                            </h:form>
                        </p:panel>
                    </ui:repeat>
                </p:panel>
                
            </ui:define>
        </ui:composition>
    </body>
</html>
